<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.18"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>embedme: libemb::RTimer Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">embedme
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><b>libemb</b></li><li class="navelem"><a class="el" href="classlibemb_1_1_r_timer.html">RTimer</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classlibemb_1_1_r_timer-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">libemb::RTimer Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>实时定时器类(每个定时器独占一个线程)  
 <a href="classlibemb_1_1_r_timer.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="_timer_8h_source.html">Timer.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for libemb::RTimer:</div>
<div class="dyncontent">
 <div class="center">
  <img src="classlibemb_1_1_r_timer.png" usemap="#libemb::RTimer_map" alt=""/>
  <map id="libemb::RTimer_map" name="libemb::RTimer_map">
<area href="classlibemb_1_1_runnable.html" title="线程运行体,子类必须重写run方法." alt="libemb::Runnable" shape="rect" coords="0,0,107,24"/>
  </map>
</div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a9a1f4ff5d6f67b82aa56cbee440acfe8"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlibemb_1_1_r_timer.html#a9a1f4ff5d6f67b82aa56cbee440acfe8">RTimer</a> (const <a class="el" href="classlibemb_1_1_timer_listener.html">TimerListener</a> &amp;listener, int <a class="el" href="classlibemb_1_1_r_timer.html#a7baba59b510de9da5458fbda682612c1">id</a>)</td></tr>
<tr class="memdesc:a9a1f4ff5d6f67b82aa56cbee440acfe8"><td class="mdescLeft">&#160;</td><td class="mdescRight">RTimer构造函数  <a href="classlibemb_1_1_r_timer.html#a9a1f4ff5d6f67b82aa56cbee440acfe8">More...</a><br /></td></tr>
<tr class="separator:a9a1f4ff5d6f67b82aa56cbee440acfe8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a14a3671120ad948121f756f9f1ed0a40"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlibemb_1_1_r_timer.html#a14a3671120ad948121f756f9f1ed0a40">start</a> (int usTimeout, int usTick, bool repeat=false)</td></tr>
<tr class="memdesc:a14a3671120ad948121f756f9f1ed0a40"><td class="mdescLeft">&#160;</td><td class="mdescRight">启动定时器  <a href="classlibemb_1_1_r_timer.html#a14a3671120ad948121f756f9f1ed0a40">More...</a><br /></td></tr>
<tr class="separator:a14a3671120ad948121f756f9f1ed0a40"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8da735814c1121a8ef1b1af2c4ac0ed7"><td class="memItemLeft" align="right" valign="top"><a id="a8da735814c1121a8ef1b1af2c4ac0ed7"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlibemb_1_1_r_timer.html#a8da735814c1121a8ef1b1af2c4ac0ed7">stop</a> ()</td></tr>
<tr class="memdesc:a8da735814c1121a8ef1b1af2c4ac0ed7"><td class="mdescLeft">&#160;</td><td class="mdescRight">停止定时器 <br /></td></tr>
<tr class="separator:a8da735814c1121a8ef1b1af2c4ac0ed7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7baba59b510de9da5458fbda682612c1"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlibemb_1_1_r_timer.html#a7baba59b510de9da5458fbda682612c1">id</a> ()</td></tr>
<tr class="memdesc:a7baba59b510de9da5458fbda682612c1"><td class="mdescLeft">&#160;</td><td class="mdescRight">获取定时器ID  <a href="classlibemb_1_1_r_timer.html#a7baba59b510de9da5458fbda682612c1">More...</a><br /></td></tr>
<tr class="separator:a7baba59b510de9da5458fbda682612c1"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>实时定时器类(每个定时器独占一个线程) </p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a9a1f4ff5d6f67b82aa56cbee440acfe8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9a1f4ff5d6f67b82aa56cbee440acfe8">&#9670;&nbsp;</a></span>RTimer()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">libemb::RTimer::RTimer </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classlibemb_1_1_timer_listener.html">TimerListener</a> &amp;&#160;</td>
          <td class="paramname"><em>listener</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>id</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>RTimer构造函数 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">listener</td><td>定时器监听器 </td></tr>
    <tr><td class="paramname">id</td><td>定时器ID </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a7baba59b510de9da5458fbda682612c1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7baba59b510de9da5458fbda682612c1">&#9670;&nbsp;</a></span>id()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">int libemb::RTimer::id </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>获取定时器ID </p>
<dl class="section return"><dt>Returns</dt><dd>int 定时器ID </dd></dl>

</div>
</div>
<a id="a14a3671120ad948121f756f9f1ed0a40"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a14a3671120ad948121f756f9f1ed0a40">&#9670;&nbsp;</a></span>start()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool libemb::RTimer::start </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>usTimeout</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>usTick</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>repeat</em> = <code>false</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>启动定时器 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">usTimeout</td><td>定时时间 </td></tr>
    <tr><td class="paramname">usTick</td><td>时间颗粒度(必须要小于usTimeout,颗粒度越小,定时精度越高,但CPU负荷越重) </td></tr>
    <tr><td class="paramname">repeat</td><td>是否重复 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true 启动成功 </dd>
<dd>
false 启动失败 </dd></dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>src/<a class="el" href="_timer_8h_source.html">Timer.h</a></li>
<li>src/Timer.cpp</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.18
</small></address>
</body>
</html>
